package com.lmf.cloud.controller;

import com.lmf.cloud.feign.MyControllerFeign;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description TODO
 * <p>
 * Copyright @2022 Shanghai Mise Co. Ltd.
 * All right reserved.
 * <p>
 * @Author LiuMingFu
 * @Date 2024/7/22 21:33
 */
@Slf4j
@RefreshScope   //在控制器类加入@RefreshScope注解使当前类下的配置支持Nacos的动态刷新功能，保持最新值
@RequestMapping("/nacos-config")
@RestController
public class MyController {

    @Resource
    private MyControllerFeign myControllerFeign;
    @Value("${test.lmf.app}")
    private String name;


    @RequestMapping("/getName")
    public String getName() {
        log.info("name={}", name);
        return name;
    }


    @RequestMapping("/getData")
    public String getData() {
        String feignData2 = myControllerFeign.getData2("哈哈哈哈");
        log.info("feignData2={}", feignData2);
        return feignData2;
    }
}
